package com.dragon.sso.controller;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;

/**
 * @author wangjg
 */
@RestController
public class TemplateController {

    @GetMapping("/login")
    @ResponseBody
    public ModelAndView hello(@RequestParam(required = false) String error) {
        //这边我们,默认是返到templates下的login.html
        ModelAndView modelAndView = new ModelAndView("login");
        modelAndView.addObject("error", error);
        return modelAndView;
    }

    @GetMapping("/index")
    @ResponseBody
    public ModelAndView index() {
        //这边我们,默认是返到templates下的login.html
        return new ModelAndView("index");
    }


}
